package com.yellowpage.bigdata.service;

import java.util.List;
import java.util.Map;

import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;

import com.yellowpage.white.common.Constants;
import com.yellowpage.white.common.PageRender;
import com.yellowpage.white.dao.QueryAssistantSQL;
import com.yellowpage.white.service.BaseServiceImpl;

import com.yellowpage.bigdata.data.UserInfoCount;
import com.yellowpage.bigdata.dao.UserInfoCountDao;

public class UserInfoCountServiceImpl extends BaseServiceImpl implements
		UserInfoCountService {
	private UserInfoCountDao userInfoCountDao;

	public void setUserInfoCountDao(UserInfoCountDao userInfoCountDao) {
		this.userInfoCountDao = userInfoCountDao;
	}

	/* Smooth generate Method */
	public UserInfoCount getUserInfoCount(Long id) {
		return userInfoCountDao.get(id);
	}

	public List<UserInfoCount> getAllUserInfoCount() {
		return userInfoCountDao.getAll();
	}

	public List<Map> queryUserInfoCountByPage(Map queryMap,
			PageRender pageRender) {

		QueryAssistantSQL sqlAssistant = baseDao
				.newQueryAssistantSQL(
						"SELECT a.id , a.date , a.othernum , a.dxnum , a.usernum , a.unicom, a.cmcc   FROM USER_INFO_COUNT a WHERE 1=1 ")
				.addCondition(" and date >= :date ")
				.addCondition(" and date <= :end_date ");

		List<Map> resultList = sqlAssistant.queryByPage(
				baseDao.getConnection(), queryMap, pageRender);

		return resultList;
	}

	public void saveUserInfoCount(UserInfoCount userInfoCount) {
		userInfoCountDao.save(userInfoCount);
	}

	public void updateUserInfoCount(UserInfoCount userInfoCount) {
		userInfoCountDao.update(userInfoCount);
	}

	public void delete(List deleteList) {
		userInfoCountDao.remove(deleteList);
	}

}